package com.happy016.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;


/**
 * 表示为Spring 配置类
 * @author Linyb
 * @since 2017/9/25 15:50
 */
@Configuration
public class SelfConfiguration extends WebMvcConfigurerAdapter {


    /**
     * 注册Bean
     * @author Linyb
     * @since 2017/9/25 15:49
     */
    @Bean
    public SelfAnnoHandler getSelfAnnoHandler(){
        return new SelfAnnoHandler();
    }

    /**
     * 自定义注解对应的url规则
     * @author Linyb
     * @since 2017/9/25 15:49
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(getSelfAnnoHandler()).addPathPatterns("/**");
    }
}
